package org.dydl.service.system.impl;

import java.util.List;

import org.apache.commons.lang.StringUtils;
import org.dydl.common.dto.ResponseData;
import org.dydl.common.dto.ResponseMessage;
import org.dydl.dao.system.repository.IAreaListRepository;
import org.dydl.dao.system.repository.IAreaRepository;
import org.dydl.dao.system.repository.IBusinessListRepository;
import org.dydl.model.system.Area;
import org.dydl.model.system.AreaList;
import org.dydl.model.system.AreaProductList;
import org.dydl.model.system.BusinessList;
import org.dydl.service.system.IAreaService;
import org.dydl.service.system.IBusinessListService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

/**  
 * @ClassName: BusinessListServiceImpl  
 * @Description: TODO(这里用一句话描述这个类的作用)  
 * @author 55436  
 * @date 2019年12月19日    
 */
@Service
public class AreaServiceImpl implements IAreaService {
	
	@Autowired
	private IAreaRepository areaRepository;
	
	@Autowired
	private IAreaListRepository areaListRepository;
	
	
	
	private ResponseMessage res = new ResponseMessage();

	
	@Override
	public List<AreaList> list(String businseeId) {
		
		List<AreaList> list = areaListRepository.getAreaList(businseeId);

		
		return list;
	
	}


	/* (non-Javadoc)
	 * @see org.yorma.service.system.IBusinessListService#detailList(java.lang.String)
	 */
	@Override
	public ResponseMessage detailList(String orderNo) {
		
		
		
		return null;
	}


	@Override
	public List<Area> getArea(String name) {
		
		List<Area> list = areaRepository.get(name);
		
		return list;
	}


	@Override
	public ResponseMessage save(AreaList areaList) {
		
		try {
			areaListRepository.save(areaList);
			res.setSuccess(true);
			return res;
		} catch (Exception e) {
			res.setSuccess(false);
			res.setMsg(e.getMessage());
			return res;
		}
		
	}

}
